using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.MyTable.Data;

using SmsBodyTable = CentralOffice.MyTable.Data.SmsDataSet.sms_bodyDataTable;
using SmsBodyRow = CentralOffice.MyTable.Data.SmsDataSet.sms_bodyRow;
namespace CentralOffice.MyTable.DataAccess
{
    public class SmsBodyAdapter : DataAccessAdapter<MyTable.Data.SmsDataSet, SmsBodyTable, SmsBodyRow>
    {
        public SmsBodyAdapter()
        {
            this.TableName = "sms_body";
            DeleteStoredProc = "SmsBody_DeleteSmsBody";

            GetAllStoredProc = "SmsBody_SelectSmsBodyAll";
            InsertStoredProc = "SmsBody_InsertSmsBody";
            UpdateStoredProc = "SmsBody_UpdateSmsBody";
            FindStoredProc = "SmsBody_SelectSmsBodyDynamic";
            GetByIdStoredProc = "SmsBody_SelectSmsBody";
            GetPagedStoredProc = "SmsBody_SelectSmsBodyPaged";
            GetRowCountStoredProc = "SmsBody_SelectSmsBodyRowCount";
        }

        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "FromId", DbType.String, "FromId", DataRowVersion.Current);
            db.AddInParameter(cmd, "SmsType", DbType.String, "SmsType", DataRowVersion.Current);
            db.AddInParameter(cmd, "Content", DbType.String, "Content", DataRowVersion.Current);
            db.AddInParameter(cmd, "SendTime", DbType.DateTime, "SendTime", DataRowVersion.Current);
            db.AddInParameter(cmd, "RemindUrl", DbType.String, "RemindUrl", DataRowVersion.Current);
            db.AddInParameter(cmd, "sGuid", DbType.String, "sGuid", DataRowVersion.Current);

            db.AddInParameter(cmd, "FromName", DbType.String, "FromName", DataRowVersion.Current);
        }

        protected override void PopulateUpdateParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "Id", DbType.Int32, "BodyId", System.Data.DataRowVersion.Current);
            PopulateInsertParameters(db, cmd);
        }
    }
}
